﻿Public Class AdminBorrow
    Inherits System.Web.UI.Page
    Dim mt As New MuonTra_BLL()
    Dim p As New MuonTra_DTO()
    Dim dg As New DocGia_BLL()
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    
    Protected Sub btn_xacnhanmuon_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_xacnhanmuon.Click
      
        popup_muonsach.ContentUrl = "~/popup_templates/AdminInfoBorrowed.aspx?id_sach=" + tkb_idsach.Text + "&sosach=" + tkb_idsach.Tokens.Count.ToString() + "&ngaymuon=" + de_ngaymuon.Text + "&ngaytra=" + de_ngaytra.Text + "&taikhoan=" + cb_taikhoan.SelectedItem.Text + "&kieumuon=" + cbb_kieumuon.SelectedItem.Value
        popup_muonsach.ShowOnPageLoad = True


    End Sub

    Protected Sub tkb_idsach_Init(ByVal sender As Object, ByVal e As EventArgs) Handles tkb_idsach.Init
        tkb_idsach.DataSource = mt.loadSachduocmuon()
        tkb_idsach.DataBind()
    End Sub

    Protected Sub btn_xacnhantra_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_xacnhantra.Click
        popup_trasach.ContentUrl = "~/popup_templates/AdminConfirmReturn.aspx?id_sach=" + tkb_masachtra.Text + "&sosach=" + tkb_masachtra.Tokens.Count.ToString() + "&ngaytra=" + de_chonngaytra.Text + "&taikhoan=" + cb_taikhoantra.Text
        popup_trasach.ShowOnPageLoad = True
    End Sub

    Protected Sub de_ngaytra_Init(ByVal sender As Object, ByVal e As EventArgs) Handles de_ngaytra.Init
        de_ngaytra.MinDate = Date.Today.AddDays(0)

    End Sub

    Protected Sub de_chonngaytra_Init(ByVal sender As Object, ByVal e As EventArgs) Handles de_chonngaytra.Init
        de_chonngaytra.MinDate = Date.Today.AddDays(0)
        de_chonngaytra.Date = Date.Now()
    End Sub

    Protected Sub cb_taikhoan_Init(ByVal sender As Object, ByVal e As EventArgs) Handles cb_taikhoan.Init
        Try
            cb_taikhoan.DataSource = dg.load_DocGia()
            cb_taikhoan.DataBind()
        Catch
        End Try

    End Sub

    Protected Sub cb_taikhoantra_Init(ByVal sender As Object, ByVal e As EventArgs) Handles cb_taikhoantra.Init
        Try
            cb_taikhoantra.DataSource = mt.loadDocGiaTra()
            cb_taikhoantra.DataBind()
        Catch
        End Try

    End Sub

    Protected Sub cb_taikhoantra_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cb_taikhoantra.SelectedIndexChanged
        Try
            p._taikhoan = cb_taikhoantra.SelectedItem.Text
            tkb_masachtra.DataSource = mt.loadSachDocGiaMuon(p)
            tkb_masachtra.DataBind()
        Catch
        End Try
    End Sub
End Class